let _ = 
  (* f(x) = x * (x - 10) *)
  let f mem a b x g = 
    for i = 0 to 999 do
      mem.(i) <- mem.(i) + 1
    done ;
    g.(0) <- a *. 2.0 *. x.(0) -. a *. b;
    for i = 0 to 999 do
      mem.(i) <- mem.(i) + 1
    done ;
    a *. (x.(0) -. b) *. x.(0) in
  let x = [|0.0|] in
  let mem = Array.create 1000 0 in
  let (iters, fx) = Lbfgs.minimize (f mem 1.0 10.0) x in
  Printf.printf "Result of %f took %d iters.  Final value %f.\n" x.(0) iters fx
